package com.springboot.springbootlogindemo.controller;


import com.springboot.springbootlogindemo.service.FollowService;
import com.springboot.springbootlogindemo.utils.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController//表明此类是一个控制器类,且返回的不是视图，而是数据
@RequestMapping("/follow")//控制器类的基路由
public class FollowController {

    @Resource
    private FollowService followService;

    /**
     * 实现关注
     * @param followId
     * @return
     */
    @PostMapping
    public Result follow(@RequestParam Long followId){
        return followService.follow(followId);
    }

    /**
     * 展示关注，用于展示关注页面
     * @return
     */
    @GetMapping("/showAll")
    public Result showFollows(){
        return followService.showAll();
    }


    /**
     * 显示具体关注对象的信息，用于点开某个关注对象页面
     * @param followId
     * @return
     */
    @GetMapping("/showOne")
    public Result showFollowDetail(@RequestParam Long followId){
        return followService.showOne(followId);
    }

}
